1. Field of the Invention
The present invention relates to a memory management unit and a memory management method. More particularly, it relates to a memory management unit and a memory management method favorable to manage a memory installed in an electronic device.
2. Description of the Related Art
In a memory installed in an electronic device such as a computer, memory areas which are necessary for respective operations of internal devices and external devices such as a printer are allocated when the computer is started up, and the allocation is released in accordance with the progress of processing to form unused memory area.
In such memory, a fragmentation of memory area (fragmentation of unused memory area) occurs when a part of the allocated memory areas is released.
Specifically, in a memory area having unused area of 16M (byte) as shown in FIG. 6A, the unused area is reduced to 8M when 2M allocation (holding of area) is performed for four times (USED FOR AAA, USED FOR BBB, USED FOR CCC, USED FOR DDD) as shown in FIG. 6B.
Thereafter, when the allocations of the initial three memory areas (USED FOR AAA, USED FOR BBB, USED FOR CCC) are released as shown in FIG. 6C, a maximum size of the allocable memory area remains 8M even though there are 14M (6M+8M) of unused memory areas in total. Therefore, the unused memory area of 14M is in a state of being fragmented, thereby causing the fragmentation.
In such state of memory, large and successive memory blocks cannot be held. Therefore, a garbage-collection function for assembling unused memory areas is executed. The garbage-collection function is one of functions of an OS (Operating System) to eliminate the fragmentation.
Further, there are various other technologies to eliminate the fragmentation. For example, a method disclosed in Japanese Patent Unexamined Publication No. 2005-73004 is also one of them.
However, the above-described garbage collection operation executed to eliminate the fragmentation occupies a CPU for a long time. Therefore, a means for preventing the fragmentation from occurring is desired. However, any effective solution cannot be found in the current situation.
Since the CPU cannot be occupied for eliminating the fragmentation especially in a real-time OS, the garbage collection operation is less used.
Further, in the invention disclosed in the Japanese Patent Unexamined Publication No. 2005-73004, it is required to manage memory areas of two or more memories. Therefore, since the CPU is occupied for a long time like the case of the above-described garbage-collection operation, it cannot be said it is an effective solution.